package jdk8的特性.练习案例;

import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author idea
 * @data 2018/9/10
 */
public class SortExample {

    public static void main(String[] args) {
        List<User> userList = MockDB.mockUserList(10);
        List<User>  users=userList.parallelStream()
                //按照id来进行排序
                .sorted(Comparator.comparing(User::getId).reversed())
                .collect(Collectors.toList());
        for (User user : users) {
            System.out.println(user.toString());
        }
    }


}
